type P1 = Promise<[1, 2]>;
const p: P1 = new Promise(() => {});
type Test1<T> = T extends (infer R)[] ? R[] : T;
// type T1 = Test1<[1, 2]>;
// const test: T1 = [1, 2];

type MyPromiseAll<T> = T extends any[] ? [...T] : never;
type P2 = MyPromiseAll<[1, 2]>;

type MyPromiseAllTest1<T> = T extends any[] ? { [K in keyof T]: T } : never;
type PTest1 = MyPromiseAllTest1<[1, 2]>;

// export {};
// declare function PromiseAll<T extends any[]>(
//   values: readonly [...T]
// ): Promise<{ [K in keyof T]: T[K] extends Promise<infer R> ? R : T[K] }>;

declare function PromiseAll<T extends any[]>(
  values: readonly [...T]
): Promise<{
  [K in keyof T]: T[K] extends Promise<infer R>
    ? R
    : T[K] extends number
    ? T[K]
    : number;
}>;
